// @ts-nocheck
/**
 * @Date: 2022-04-16 10:14:51
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-04-20 14:59:44
 * @FilePath: \weibo-api\routes\topics.js
 * @Description: 评论路由
 */
const router = require("koa-router")();
const { auth } = require("../middleware/loginCheck");
const {
  createTopic,
  getTopicList,
  createReply,
  deleteComment,
} = require("../controller/topicCtl");
const { checkCommentOwn } = require("../middleware/check");
router.prefix("/api/topics");
//创建评论
router.post("/:blogId", auth, createTopic);
//回复评论
router.post(
  "/reply/:replyUserId/:parantId/:commentId/:blogId",
  auth,
  createReply,
);
//获取评论列表
router.get("/:blogId", getTopicList);
//删除评论
router.delete("/:commentId", auth, checkCommentOwn, deleteComment);
module.exports = router;
